package com.baba.shop.utils;

import java.util.List;

public class Page<T> {
	private List<T> list;
	private Integer pageNum;
	private Integer pageSize = 5;
	private Integer total;
	private Integer totalPage;
	public Page(Integer pageNum,Integer pageSize,Integer total) {
		if(pageNum==null||pageNum<1)
			pageNum = 1;
		this.pageNum = pageNum;
		if(pageSize!=null)
			this.pageSize = pageSize;
		if(total!=null)
			this.total=total;
		if(total%pageSize==0) {
			totalPage = total/pageSize;
		}else {
			totalPage = total/pageSize+1;
		}
			
	}
	
	public void setList(List<T> list) {
		this.list = list;
	}
	
	public List<T> getList() {
		return list;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	@Override
	public String toString() {
		return "Page [list=" + list + ", pageNum=" + pageNum + ", pageSize=" + pageSize + ", total=" + total + "]";
	}
	
	
	
}
